home *** CD-ROM | disk | FTP | other *** search
-
- #include <stdio.h>
-
- /****************************************************************
- * *
- * - makedb - *
- * *
- * Convert a binary file to a bunch of DB's *
- * for an assembler. *
- * *
- * T. Jennings 25 Oct. 82 *
- * *
- ****************************************************************/
-
-
- main(argc,argv)
- int argc;
- char **argv;
- {
- int infile;
- unsigned i;
- int column;
- char data;
-
- printf("\nMake DB's from a binary file to <stdout>\n");
- printf(" T. Jennings 25 Oct. 82\n");
-
- if (argc < 2) {
- printf("Must supply a file name!\n");
- exit(1);
- }
- infile= open(argv[1],0x8000);
- if (infile == -1 ) {
- printf("Can't find %s\n",argv[1]);
- exit(1);
- }
- column= 80;
- while (read(infile,&data,1) ) {
- if (column > 28) {
- printf("\n\tdb\t");
- column= 0;
- }
- if (column > 0)
- printf(",");
- printf("%u",data);
-
- /* KLUDGE: Guess the length of the thing we just typed, so we can keep
- the columns neat. */
- i= data;
- column+=2; /* count the comma, 1's digit, */
- if(i > 10)
- ++column; /* tens, */
- if (i > 100)
- ++ column; /* 100's */
- }
- printf("\n");
- exit(0);
- }
-